package com.nf.practice.sortlist;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ArrayListTest3 {
    public static void main(String[] args) {
        List<Person3> list = new ArrayList<>();
        //产生20以内的随机数
        int num = (int)(Math.random()*20+1);
        for(int i=num;i>0;i--){
            list.add(new Person3(""+i,"张三","河南"));
        }
        for(Object o : list){
            System.out.println(o);
        }

        System.out.println("==================================升序排列==================================");

        Collections.sort(list);
        for(Object o : list){
            System.out.println(o);
        }
    }
}